package bestTeam.WalkieDoggie.client.Composites;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import bestTeam.WalkieDoggie.client.WalkieDoggie;
import bestTeam.WalkieDoggie.client.Serializables.FBFriend;
import bestTeam.WalkieDoggie.client.Serializables.UserProfileData;

import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HasVerticalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.PopupPanel;
import com.google.gwt.user.client.ui.VerticalPanel;

public class mutualFriendsPopup extends PopupPanel {
	private FBFriend[] friends;

	public mutualFriendsPopup(List<FBFriend> mutualFriends) {
		super(true);

		VerticalPanel verticalPanel = new VerticalPanel();

		this.setWidget(verticalPanel);
		FlexTable mutualFriendsTable = new FlexTable();
		verticalPanel.add(mutualFriendsTable);

		for (FBFriend friend: mutualFriends){
			
			int row = mutualFriendsTable.getRowCount();
			
			Image picture = new Image("https://graph.facebook.com/" + friend.getId()
					+ "/picture?type=small");
			String friendName = friend.getName();
			String friendLink = friend.getLink();
			Anchor friendHprlnk = new Anchor(friendName, false,
					friendLink, "_blank");

			mutualFriendsTable.setWidget(row, 0, friendHprlnk);
			mutualFriendsTable.setWidget(row, 1, picture);
			
		}
	}
}
		
